<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>dopmtr.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="DOPMTR.1"></a><a href="dopmtr.f.html#DOPMTR.1">DOPMTR</a>( SIDE, UPLO, TRANS, M, N, AP, TAU, C, LDC, WORK,
     $                   INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      CHARACTER          SIDE, TRANS, UPLO
      INTEGER            INFO, LDC, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      DOUBLE PRECISION   AP( * ), C( LDC, * ), TAU( * ), WORK( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="DOPMTR.19"></a><a href="dopmtr.f.html#DOPMTR.1">DOPMTR</a> overwrites the general real M-by-N matrix C with
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                  SIDE = 'L'     SIDE = 'R'
</span><span class="comment">*</span><span class="comment">  TRANS = 'N':      Q * C          C * Q
</span><span class="comment">*</span><span class="comment">  TRANS = 'T':      Q**T * C       C * Q**T
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where Q is a real orthogonal matrix of order nq, with nq = m if
</span><span class="comment">*</span><span class="comment">  SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
</span><span class="comment">*</span><span class="comment">  nq-1 elementary reflectors, as returned by <a name="DSPTRD.27"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a> using packed
</span><span class="comment">*</span><span class="comment">  storage:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SIDE    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'L': apply Q or Q**T from the Left;
</span><span class="comment">*</span><span class="comment">          = 'R': apply Q or Q**T from the Right.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  UPLO    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'U': Upper triangular packed storage used in previous
</span><span class="comment">*</span><span class="comment">                 call to <a name="DSPTRD.43"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a>;
</span><span class="comment">*</span><span class="comment">          = 'L': Lower triangular packed storage used in previous
</span><span class="comment">*</span><span class="comment">                 call to <a name="DSPTRD.45"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TRANS   (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'N':  No transpose, apply Q;
</span><span class="comment">*</span><span class="comment">          = 'T':  Transpose, apply Q**T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix C. M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix C. N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  AP      (input) DOUBLE PRECISION array, dimension
</span><span class="comment">*</span><span class="comment">                               (M*(M+1)/2) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment">                               (N*(N+1)/2) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment">          The vectors which define the elementary reflectors, as
</span><span class="comment">*</span><span class="comment">          returned by <a name="DSPTRD.61"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a>.  AP is modified by the routine but
</span><span class="comment">*</span><span class="comment">          restored on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TAU     (input) DOUBLE PRECISION array, dimension (M-1) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment">                                     or (N-1) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment">          TAU(i) must contain the scalar factor of the elementary
</span><span class="comment">*</span><span class="comment">          reflector H(i), as returned by <a name="DSPTRD.67"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
</span><span class="comment">*</span><span class="comment">          On entry, the M-by-N matrix C.
</span><span class="comment">*</span><span class="comment">          On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDC     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array C. LDC &gt;= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) DOUBLE PRECISION array, dimension
</span><span class="comment">*</span><span class="comment">                                   (N) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment">                                   (M) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0:  if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      DOUBLE PRECISION   ONE
      PARAMETER          ( ONE = 1.0D+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            FORWRD, LEFT, NOTRAN, UPPER
      INTEGER            I, I1, I2, I3, IC, II, JC, MI, NI, NQ
      DOUBLE PRECISION   AII
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.96"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL           <a name="LSAME.97"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="DLARF.100"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>, <a name="XERBLA.100"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input arguments
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      LEFT = <a name="LSAME.110"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'L'</span> )
      NOTRAN = <a name="LSAME.111"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'N'</span> )
      UPPER = <a name="LSAME.112"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     NQ is the order of Q
</span><span class="comment">*</span><span class="comment">
</span>      IF( LEFT ) THEN
         NQ = M
      ELSE
         NQ = N
      END IF
      IF( .NOT.LEFT .AND. .NOT.<a name="LSAME.121"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'R'</span> ) ) THEN
         INFO = -1
      ELSE IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.123"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
         INFO = -2
      ELSE IF( .NOT.NOTRAN .AND. .NOT.<a name="LSAME.125"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'T'</span> ) ) THEN
         INFO = -3
      ELSE IF( M.LT.0 ) THEN
         INFO = -4
      ELSE IF( N.LT.0 ) THEN
         INFO = -5
      ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
         INFO = -9
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.135"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DOPMTR.135"></a><a href="dopmtr.f.html#DOPMTR.1">DOPMTR</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.EQ.0 .OR. N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Q was determined by a call to <a name="DSPTRD.146"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a> with UPLO = 'U'
</span><span class="comment">*</span><span class="comment">
</span>         FORWRD = ( LEFT .AND. NOTRAN ) .OR.
     $            ( .NOT.LEFT .AND. .NOT.NOTRAN )
<span class="comment">*</span><span class="comment">
</span>         IF( FORWRD ) THEN
            I1 = 1
            I2 = NQ - 1
            I3 = 1
            II = 2
         ELSE
            I1 = NQ - 1
            I2 = 1
            I3 = -1
            II = NQ*( NQ+1 ) / 2 - 1
         END IF
<span class="comment">*</span><span class="comment">
</span>         IF( LEFT ) THEN
            NI = N
         ELSE
            MI = M
         END IF
<span class="comment">*</span><span class="comment">
</span>         DO 10 I = I1, I2, I3
            IF( LEFT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              H(i) is applied to C(1:i,1:n)
</span><span class="comment">*</span><span class="comment">
</span>               MI = I
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              H(i) is applied to C(1:m,1:i)
</span><span class="comment">*</span><span class="comment">
</span>               NI = I
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Apply H(i)
</span><span class="comment">*</span><span class="comment">
</span>            AII = AP( II )
            AP( II ) = ONE
            CALL <a name="DLARF.186"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>( SIDE, MI, NI, AP( II-I+1 ), 1, TAU( I ), C, LDC,
     $                  WORK )
            AP( II ) = AII
<span class="comment">*</span><span class="comment">
</span>            IF( FORWRD ) THEN
               II = II + I + 2
            ELSE
               II = II - I - 1
            END IF
   10    CONTINUE
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Q was determined by a call to <a name="DSPTRD.198"></a><a href="dsptrd.f.html#DSPTRD.1">DSPTRD</a> with UPLO = 'L'.
</span><span class="comment">*</span><span class="comment">
</span>         FORWRD = ( LEFT .AND. .NOT.NOTRAN ) .OR.
     $            ( .NOT.LEFT .AND. NOTRAN )
<span class="comment">*</span><span class="comment">
</span>         IF( FORWRD ) THEN
            I1 = 1
            I2 = NQ - 1
            I3 = 1
            II = 2
         ELSE
            I1 = NQ - 1
            I2 = 1
            I3 = -1
            II = NQ*( NQ+1 ) / 2 - 1
         END IF
<span class="comment">*</span><span class="comment">
</span>         IF( LEFT ) THEN
            NI = N
            JC = 1
         ELSE
            MI = M
            IC = 1
         END IF
<span class="comment">*</span><span class="comment">
</span>         DO 20 I = I1, I2, I3
            AII = AP( II )
            AP( II ) = ONE
            IF( LEFT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              H(i) is applied to C(i+1:m,1:n)
</span><span class="comment">*</span><span class="comment">
</span>               MI = M - I
               IC = I + 1
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              H(i) is applied to C(1:m,i+1:n)
</span><span class="comment">*</span><span class="comment">
</span>               NI = N - I
               JC = I + 1
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Apply H(i)
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="DLARF.242"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>( SIDE, MI, NI, AP( II ), 1, TAU( I ),
     $                  C( IC, JC ), LDC, WORK )
            AP( II ) = AII
<span class="comment">*</span><span class="comment">
</span>            IF( FORWRD ) THEN
               II = II + NQ - I + 1
            ELSE
               II = II - NQ + I - 2
            END IF
   20    CONTINUE
      END IF
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="DOPMTR.255"></a><a href="dopmtr.f.html#DOPMTR.1">DOPMTR</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
